]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status: Respect always-show-universal-access-status setting
authorTanner Doshier <doshitan@gmail.com>
Tue, 13 Aug 2013 16:39:07 +0000 (11:39 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 16 Aug 2013 13:05:10 +0000 (09:05 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=705733

js/ui/status/accessibility.js

index 35d92e2bd879bd1de1dc2064d7bf9a5f47144b58..bab194f10be1fd17a1607a71d3a1bbd5c052dfda 100644 (file)
@@ -9,7 +9,10 @@ const St = imports.gi.St;
 const PanelMenu = imports.ui.panelMenu;
 const PopupMenu = imports.ui.popupMenu;
 
-const A11Y_SCHEMA = 'org.gnome.desktop.a11y.keyboard';
+const A11Y_SCHEMA = 'org.gnome.desktop.a11y'
+const KEY_ALWAYS_SHOW = 'always-show-universal-access-status';
+
+const A11Y_KEYBOARD_SCHEMA = 'org.gnome.desktop.a11y.keyboard'
 const KEY_STICKY_KEYS_ENABLED = 'stickykeys-enable';
 const KEY_BOUNCE_KEYS_ENABLED = 'bouncekeys-enable';
 const KEY_SLOW_KEYS_ENABLED   = 'slowkeys-enable';
@@ -46,6 +49,9 @@ const ATIndicator = new Lang.Class({
 
         this.actor.add_child(this._hbox);
 
+        this._a11ySettings = new Gio.Settings({ schema: A11Y_SCHEMA });
+        this._a11ySettings.connect('changed::' + KEY_ALWAYS_SHOW, Lang.bind(this, this._queueSyncMenuVisibility));
+
         let highContrast = this._buildHCItem();
         this.menu.addMenuItem(highContrast);
 
@@ -67,16 +73,16 @@ const ATIndicator = new Lang.Class({
         let visualBell = this._buildItem(_("Visual Alerts"), WM_SCHEMA, KEY_VISUAL_BELL);
         this.menu.addMenuItem(visualBell);
 
-        let stickyKeys = this._buildItem(_("Sticky Keys"), A11Y_SCHEMA, KEY_STICKY_KEYS_ENABLED);
+        let stickyKeys = this._buildItem(_("Sticky Keys"), A11Y_KEYBOARD_SCHEMA, KEY_STICKY_KEYS_ENABLED);
         this.menu.addMenuItem(stickyKeys);
 
-        let slowKeys = this._buildItem(_("Slow Keys"), A11Y_SCHEMA, KEY_SLOW_KEYS_ENABLED);
+        let slowKeys = this._buildItem(_("Slow Keys"), A11Y_KEYBOARD_SCHEMA, KEY_SLOW_KEYS_ENABLED);
         this.menu.addMenuItem(slowKeys);
 
-        let bounceKeys = this._buildItem(_("Bounce Keys"), A11Y_SCHEMA, KEY_BOUNCE_KEYS_ENABLED);
+        let bounceKeys = this._buildItem(_("Bounce Keys"), A11Y_KEYBOARD_SCHEMA, KEY_BOUNCE_KEYS_ENABLED);
         this.menu.addMenuItem(bounceKeys);
 
-        let mouseKeys = this._buildItem(_("Mouse Keys"), A11Y_SCHEMA, KEY_MOUSE_KEYS_ENABLED);
+        let mouseKeys = this._buildItem(_("Mouse Keys"), A11Y_KEYBOARD_SCHEMA, KEY_MOUSE_KEYS_ENABLED);
         this.menu.addMenuItem(mouseKeys);
 
         this._syncMenuVisibility();
@@ -85,9 +91,10 @@ const ATIndicator = new Lang.Class({
     _syncMenuVisibility: function() {
         this._syncMenuVisibilityIdle = 0;
 
+        let alwaysShow = this._a11ySettings.get_boolean(KEY_ALWAYS_SHOW);
         let items = this.menu._getMenuItems();
 
-        this.actor.visible = items.some(function(f) { return !!f.state; });
+        this.actor.visible = alwaysShow || items.some(function(f) { return !!f.state; });
 
         return false;
     },